Python Program to Generate A Random Number
Q. Write a Python program to generate a random number. A random number can be any number between given two numbers.
Use randint()
function defined under the random python module. It accept two parameters of start and end number.
1 2 3 4 5 6 | ## Python program to generate a random number import random x = random.randint(10, 50) print(x) |
Execute above script and it will return a random number between given numbers.
Output:
33
Output value may change with each run.